package com.cn.wanxi.servlet.back.user;

import com.alibaba.fastjson.JSONObject;
import com.cn.wanxi.model.UserModel;
import com.cn.wanxi.service.UserService;
import com.cn.wanxi.service.impl.UserServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

public class UserFindByIdServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        UserService userService = new UserServiceImpl();
        UserModel model = userService.findById(1);
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("data", model);
        jsonObject.put("code", 0);
        jsonObject.put("message", "增加成功");
        jsonObject.put("total", 1);//影响的条数
        resp.getWriter().println(jsonObject);
    }
}
